package com.education.welco.controller.app;

import com.education.common.utils.ApiReturnObject;
import com.education.welco.pojo.LAgreement;
import com.education.welco.service.ILAgreementService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * 协议表
 *
 * @date 2020-05-21 10:50:11
 */
@RestController
@RequestMapping("/app/lagreement")
public class AppLAgreementController {


    @Autowired
    private ILAgreementService ilAgreementService;



    @ApiOperation(value = "查询用户协议", httpMethod = "GET")
    @GetMapping("/selectOne")
    public ApiReturnObject selectOne(String type){
        LAgreement lAgreement = new LAgreement();
        // 1 : 用户登陆协议  2 : 隐私政策
        lAgreement.setType(type);
        List<LAgreement> lAgreementList = ilAgreementService.selectLAgreementList(lAgreement);
        if (lAgreementList.size() == 0){
            return new ApiReturnObject("201","用户协议不存在","用户协议不存在");
        }
        return new ApiReturnObject("200","查询成功",lAgreementList.get(0));
    }

}
